﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package org.aswing {
    import flash.display.*;
    import org.aswing.graphics.*;

    public class AssetIcon implements Icon {

        protected var width:int;
        protected var height:int;
        protected var scale:Boolean;
        protected var asset:DisplayObject;
        protected var assetContainer:DisplayObjectContainer;
        protected var maskShape:Shape;

        public function AssetIcon(_arg1:DisplayObject=null, _arg2:int=-1, _arg3:int=-1, _arg4:Boolean=false){
            this.asset = _arg1;
            this.scale = _arg4;
            if ((((_arg2 == -1)) && ((_arg3 == -1)))){
                if (_arg1){
                    this.width = _arg1.width;
                    this.height = _arg1.height;
                } else {
                    this.width = 0;
                    this.height = 0;
                };
            } else {
                this.width = _arg2;
                this.height = _arg3;
                this.assetContainer = AsWingUtils.createSprite(null, "assetContainer");
                this.maskShape = AsWingUtils.createShape(this.assetContainer, "maskShape");
                this.maskShape.graphics.beginFill(0xFF0000);
                this.maskShape.graphics.drawRect(0, 0, _arg2, _arg3);
                this.maskShape.graphics.endFill();
                if (_arg1){
                    this.assetContainer.addChild(_arg1);
                    _arg1.mask = this.maskShape;
                    if (_arg4){
                        _arg1.width = _arg2;
                        _arg1.height = _arg3;
                    };
                };
            };
        }
        public function getAsset():DisplayObject{
            return (this.asset);
        }
        protected function setWidth(_arg1:int):void{
            this.width = _arg1;
        }
        protected function setHeight(_arg1:int):void{
            this.height = _arg1;
        }
        public function updateIcon(_arg1:Component, _arg2:Graphics2D, _arg3:int, _arg4:int):void{
            var _local5:DisplayObject = this.getDisplay(_arg1);
            if (_local5){
                _local5.x = _arg3;
                _local5.y = _arg4;
            };
        }
        public function getIconHeight(_arg1:Component):int{
            return (this.height);
        }
        public function getIconWidth(_arg1:Component):int{
            return (this.width);
        }
        public function getDisplay(_arg1:Component):DisplayObject{
            if (this.assetContainer){
                return (this.assetContainer);
            };
            return (this.asset);
        }

    }
}//package org.aswing 
